<template>
    <view :style="themeColor">
        <view class="page" >
    <view class="flex benben-position-layout flex flex-wrap align-center pointConfirmatOrder_flex_0"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-center justify-between flex-sub pointConfirmatOrder_fd0_0'      >
            <view   class='flex flex-wrap align-center pointConfirmatOrder_fd0_0_c0'   @tap.stop="handleJumpDiy" data-type="back" data-url="1"   >
        <text class='fu-iconfont2  pointConfirmatOrder_fd0_0_c0_c0'  >&#xe794;</text>
</view>
<text class='pointConfirmatOrder_fd0_0_c1'  >订单详情</text>
    <view   class='flex flex-wrap align-center pointConfirmatOrder_fd0_0_c0'      >
        </view>
</view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
<!---地址flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout pointConfirmatOrder_flex_1"    >
            <view   class='flex flex-wrap align-center pointConfirmatOrder_fd1_0'   @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/addressManagement/addressManagement?type=1`" v-if= "Object.keys(this.addressData).length"  >
        <image class='pointConfirmatOrder_fd1_0_c0'  mode="aspectFit"  :src='STATIC_URL+"247.png"'></image>
    <view   class='flex flex-direction flex-wrap align-stretch flex-sub pointConfirmatOrder_fd1_0_c1'      >
            <view   class='flex flex-wrap align-center'      >
            <view   class='flex flex-wrap align-center pointConfirmatOrder_fd1_0_c1_c0_c0'      >
        <text class='pointConfirmatOrder_fd1_0_c1_c0_c0_c0'  >{{addressData.real_name}}</text>
<text   >(</text>
<text     v-if= " addressData.sex=='1'"  >先生</text><text     v-if= " addressData.sex=='2'"  >女士</text>
<text   >)</text>
</view>
<text class='pointConfirmatOrder_fd1_0_c1_c0_c1'  >{{addressData.mobile}}</text>
</view>
    <view   class='flex flex-wrap align-center pointConfirmatOrder_fd1_0_c1_c1'      >
        <text   >{{addressData.address_code}}</text>
<text   >{{addressData.detail}}</text>
</view>
</view>
<image class='pointConfirmatOrder_fd1_0_c2'  mode="aspectFit"  :src='STATIC_URL+"77.png"'></image>
<image class='pointConfirmatOrder_fd1_0_c3'  mode="scaleToFill"  :src='STATIC_URL+"78.png"'></image>
</view>
    <view   class='flex flex-wrap align-center justify-center pointConfirmatOrder_fd1_1'   @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/addressManagement/addressManagement?type=1`" v-if= "!Object.keys(this.addressData).length"  >
        <image class='pointConfirmatOrder_fd1_0_c0'  mode="aspectFit"  :src='STATIC_URL+"247.png"'></image>
<text class='pointConfirmatOrder_fd1_1_c1'  >添加收货地址</text>
</view>
</view>
        
<!---地址flex布局结束-->
<!---商品详情flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout pointConfirmatOrder_flex_2"    >
            <view   class='flex flex-direction flex-wrap align-stretch pointConfirmatOrder_fd2_0'      >
            <view   class='flex flex-wrap align-stretch pointConfirmatOrder_fd2_0_c0'      >
        <image class='pointConfirmatOrder_fd2_0_c0_c0'  mode="scaleToFill"  :src='detailsData.tupian'></image>
    <view   class='flex flex-direction flex-wrap align-stretch justify-between flex-sub pointConfirmatOrder_fd2_0_c0_c1'      >
        <text class='pointConfirmatOrder_fd2_0_c0_c1_c0'  >{{detailsData.name}}</text>
    <view   class='flex flex-wrap align-center justify-between'      >
            <view   class='flex flex-wrap align-center'      >
        <text class='pointConfirmatOrder_fd2_0_c0_c1_c1_c0_c0'  >{{detailsData.integral}}</text>
<text class='pointConfirmatOrder_fd2_0_c0_c1_c1_c0_c0'  >积分</text>
</view>
</view>
</view>
</view>
    <view   class='flex flex-wrap align-center pointConfirmatOrder_fd2_0_c1'      >
        <text class='pointConfirmatOrder_fd2_0_c1_c0'  >积分</text>
    <view   class='flex flex-wrap align-center justify-end pointConfirmatOrder_fd2_0_c1_c1'      >
        <text   >-</text>
<text   >{{detailsData.integral}}</text>
<text   >积分</text>
</view>
</view>
    <view   class='flex align-stretch justify-end pointConfirmatOrder_fd2_0_c2'      >
        <text class='pointConfirmatOrder_fd2_0_c2_c0'  > 合计:</text>
<text class='pointConfirmatOrder_fd2_0_c2_c1'  >{{detailsData.integral}}</text>
<text class='pointConfirmatOrder_fd2_0_c2_c2'  >积分</text>
</view>
</view>
</view>
        
<!---商品详情flex布局结束-->
    <view class="flex flex-wrap align-center justify-between benben-position-layout flex pointConfirmatOrder_flex_3"    >
        <button class='pointConfirmatOrder_fd3_0'  @tap.stop="submitFunc()"  >立即兑换</button>

        </view>
<view :style="{height: '90rpx'}"  ></view>
    
    
        </view>
    </view>
</template>
<script>
    import {validate} from '@/common/utils/validate.js'
    
    export default {
        components:{},
        
        
        data(){
			return {"detailsData":{"aid":"","create_time":"","name":"","describe":"","good_code":"","atlas":[],"inventory":"","integral":"","money":"","exchange_num":"","classify":"","classify_name":"","tupian":""},"address_id":"","addressData":{"aid":"","mobile":"","label_name":"","sex":"","province_id":"","is_default":"","province":"","city":"","city_id":"","district":"","district_id":"","create_time":"","real_name":"","address_code":"","detail":"","address_code_province":"","address_code_city":"","address_code_district":"","lng":"","lat":"","address_code_area":"","address_detail":""},"getOrder":{"dingdanbianhao":"","jifen":"","xianjin":""},"id":""};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
            
		},
		watch:{},
		onLoad(options){
            let {id}=options
if (id !== undefined) this.id = id
this.getDetailsFunc()
this.getAddressFunc()
this.diyPageListen()
		},
        onUnload() {
            this.diyOffPageListen()    
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //获取地址信息
                async getAddressFunc(){
                        //请求方法
    //数据验证
    
  let dataaddressData = await this.$api.get(global.apiUrls.post636fd7826b3ee, {
    address_id:this.address_id
  });
  
  if (dataaddressData.data.code != 1) {
    this.$message.info(dataaddressData.data.msg);
    return
  } 
  let infoaddressData = dataaddressData.data;
  this.addressData = infoaddressData.data
  
                },
                //获取详情信息
                async getDetailsFunc(){
                        //请求方法
    //数据验证
    
  let datadetailsData = await this.$api.get(global.apiUrls.post63c6016ec0317, {
    aid:this.id
  });
  
  if (datadetailsData.data.code != 1) {
    this.$message.info(datadetailsData.data.msg);
    return
  } 
  let infodetailsData = datadetailsData.data;
  this.detailsData = infodetailsData.data
  
                },
                //提交积分订单
                async submitFunc(){
                                if(!validate(this.addressData.aid,'require')){
                 this.$message.info('请选择可用的地址');
                 return false;
            }
    //请求方法
    //数据验证
    
  let datagetOrder = await this.$api.dbPost(global.apiUrls.post63c646aa78a62, {
    integralgoods_id:this.id,address_id:this.addressData.aid
  });
  if(!datagetOrder) return
  if (datagetOrder.data.code != 1) {
    this.$message.info(datagetOrder.data.msg);
    return
  } 
  let infogetOrder = datagetOrder.data;
  this.getOrder = infogetOrder.data
  
    this.$urouter.redirectTo(`/pages/integral/integralSuccess/integralSuccess`);
                },
    //页面监听
    diyPageListen() {
                  uni.$on('selectAddress',(data) => {
                  this.address_id = data;
                    this.getAddressFunc()
          });
    }                     ,
    //注销页面监听
    diyOffPageListen() {
                     uni.$off('selectAddress');
    }                     
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:url(image-path('235.png')) no-repeat ,rgba(248, 248, 248, 1);background-size: 100% auto;
        }
    .pointConfirmatOrder_flex_0{
        background:url(image-path('235.png')) no-repeat ,transparent;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
    }
    .pointConfirmatOrder_fd0_0_c1{
        font-size:36rpx;font-weight:500;color:#fff;
    }
    .pointConfirmatOrder_fd0_0_c0_c0{
        font-size:32rpx;color:#fff;
    }
    .pointConfirmatOrder_fd0_0_c0{
        width:120rpx;height:88rpx;
    }
    .pointConfirmatOrder_fd0_0{
        padding:0rpx 32rpx 0rpx 32rpx;height:88rpx;
    }
    .pointConfirmatOrder_flex_1{
        padding:24rpx 24rpx 0rpx 24rpx;
    }
    .pointConfirmatOrder_fd1_1_c1{
        font-size:32rpx;font-weight:700;color:#333333;margin:0rpx 0rpx 0rpx 24rpx;
    }
    .pointConfirmatOrder_fd1_1{
        background:#fff;border-radius:16rpx 16rpx 16rpx 16rpx;background-size:100% auto !important;padding:32rpx 0rpx 32rpx 0rpx;
    }
    .pointConfirmatOrder_fd1_0_c3{
        width:702rpx;height:6rpx;position:absolute;bottom:0rpx;left:0rpx;
    }
    .pointConfirmatOrder_fd1_0_c2{
        width:12rpx;height:22rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:10rpx 24rpx 0rpx 16rpx;
    }
    .pointConfirmatOrder_fd1_0_c1_c1{
        color:rgba(102, 102, 102, 1);line-height:33rpx;margin:16rpx 0rpx 0rpx 0rpx;
    }
    .pointConfirmatOrder_fd1_0_c1_c0_c1{
        font-size:30rpx;font-weight:500;color:#333333;
    }
    .pointConfirmatOrder_fd1_0_c1_c0_c0_c0{
        -webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;max-width:150rpx;
    }
    .pointConfirmatOrder_fd1_0_c1_c0_c0{
        line-height:34rpx;font-size:30rpx;font-weight:700;color:#333333;margin:0rpx 32rpx 0rpx 0rpx;
    }
    .pointConfirmatOrder_fd1_0_c1{
        margin:0rpx 0rpx 0rpx 32rpx;
    }
    .pointConfirmatOrder_fd1_0_c0{
        width:60rpx;height:60rpx;
    }
    .pointConfirmatOrder_fd1_0{
        background:#fff;background-size:100% auto !important;border-radius:16rpx 16rpx 16rpx 16rpx;padding:40rpx 0rpx 40rpx 24rpx;position:relative;
    }
    .pointConfirmatOrder_flex_2{
        padding:24rpx 24rpx 32rpx 24rpx;
    }
    .pointConfirmatOrder_fd2_0_c2_c2{
        font-size:32rpx;font-weight:700;color:#333;line-height:40rpx;margin:0rpx 0rpx 0rpx 12rpx;
    }
    .pointConfirmatOrder_fd2_0_c2_c1{
        font-size:32rpx;font-weight:700;color:rgba(250, 32, 51, 1);line-height:40rpx;
    }
    .pointConfirmatOrder_fd2_0_c2_c0{
        margin:0rpx 10rpx 0rpx 0rpx;font-size:28rpx;font-weight:400;color:#333;line-height:40rpx;
    }
    .pointConfirmatOrder_fd2_0_c2{
        border-top:1px solid #eee;margin:32rpx 0rpx 0rpx 0rpx;padding:31rpx 0rpx 0rpx 0rpx;
    }
    .pointConfirmatOrder_fd2_0_c1_c1{
        background:transparent;font-size:28rpx;font-weight:500;color:#333333;background-size:100% auto !important;margin:0rpx 0rpx 0rpx auto;line-height:42rpx;
    }
    .pointConfirmatOrder_fd2_0_c1_c0{
        font-size:28rpx;font-weight:400;color:#333;line-height:33rpx;
    }
    .pointConfirmatOrder_fd2_0_c1{
        margin:32rpx 0rpx 0rpx 0rpx;
    }
    .pointConfirmatOrder_fd2_0_c0_c1_c1_c0_c0{
        font-size:24rpx;font-weight:700;color:#FA2033;line-height:36rpx;
    }
    .pointConfirmatOrder_fd2_0_c0_c1_c0{
        font-size:28rpx;font-weight:500;color:#333333;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;
    }
    .pointConfirmatOrder_fd2_0_c0_c1{
        margin:0rpx 0rpx 0rpx 24rpx;
    }
    .pointConfirmatOrder_fd2_0_c0_c0{
        width:200rpx;height:200rpx;border-radius:16rpx 16rpx 16rpx 16rpx;
    }
    .pointConfirmatOrder_fd2_0_c0{
        border-bottom:1px solid #eee;padding:32rpx 0rpx 32rpx 0rpx;
    }
    .pointConfirmatOrder_fd2_0{
        background:#fff;background-size:100% auto !important;padding:0rpx 24rpx 32rpx 24rpx;border-radius:16rpx;
    }
    .pointConfirmatOrder_flex_3{
        background:var(--benbenbgColor4);width:750rpx;height:90rpx;overflow:hidden;z-index:10;bottom:calc(0rpx + var(--window-bottom));background-size:100% auto !important;
    }
    .pointConfirmatOrder_fd3_0{
        background:var(--benbenbgColor2);font-size:32rpx;color:#fff;line-height:90rpx;padding:0rpx 64rpx 0rpx 64rpx;font-weight:500;width:280rpx;height:90rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:0rpx 0rpx 0rpx auto;
    }
</style>